<template>
  <div>
    <SearchTable
      v-bind="$attrs"
      :searchSchame="searchSchame"
      :tableColumns="tableColumns"
      :api="getMatterAllUnitByPage"
      :dealSearchParams="dealSearchParams"
      ref="tableRef"
    ></SearchTable>
  </div>
</template>

<script lang="ts" setup>
import SearchTable from '@/components/table/SearchTable.vue'
import { dealSearchParams, generateTableColumn, searchSchame } from './util'
import { getMatterAllUnitByPage } from '@/api/home'
import { useRouter } from 'vue-router'

const router = useRouter()

const tableColumns = generateTableColumn(tableColumnClick)

// 列表项点击
function tableColumnClick(columnType: string, row: Record<string, any>) {
  if (columnType === 'unitForShort') {
    router.push({
      path: '/events/unit-follow',
      query: {
        unitId: row.unitId,
      },
    })
  }
}
</script>
